package com.example.task1.ui.AllService.logistics;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.example.task1.R;
import com.example.task1.bean.LogisticsOrderBean;
import com.example.task1.ui.BaseAdapter;

import java.util.List;

public class LogisticsOrderAdapter extends BaseAdapter<LogisticsOrderBean.DataDTO.StepListDTO> {

    private TextView tvAddress;
    private TextView tvEvents;
    private TextView tvTime;

    private List<LogisticsOrderBean.DataDTO.StepListDTO> data;
    private Context context;

    public LogisticsOrderAdapter(List<LogisticsOrderBean.DataDTO.StepListDTO> data, Context context) {
        this.data = data;
        this.context = context;
    }

    @Override
    protected void setData(List<LogisticsOrderBean.DataDTO.StepListDTO> rows) {

    }

    @Override
    protected int getLayout() {
        return R.layout.logisticsorderlist;
    }

    @Override
    protected Context getContext() {
        return context;
    }

    @Override
    protected List<LogisticsOrderBean.DataDTO.StepListDTO> getData() {
        return data;
    }

    @Override
    protected void onBind(myHolder holder, LogisticsOrderBean.DataDTO.StepListDTO date) {
        tvAddress.setText("地点：" + date.getAddressAt());
        tvEvents.setText(date.getStateName());
        tvTime.setText("---" + date.getEventAt());
    }

    @Override
    protected void holder(View itemView) {
        initView(itemView);
    }

    private void initView(View itemView) {
        tvAddress = (TextView) itemView.findViewById(R.id.tv_address);
        tvEvents = (TextView) itemView.findViewById(R.id.tv_events);
        tvTime = (TextView) itemView.findViewById(R.id.tv_time);
    }
}
